package com.zut.blocks.base.domain;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.io.Serializable;
import java.util.Date;

/**
 * @author li
 * @param <PK>
 */
@Data
@EqualsAndHashCode
@ToString
@MappedSuperclass
@Access(value = AccessType.FIELD)
public class BaseEntity<PK extends Serializable> extends BaseDomain {

    private static final long serialVersionUID = -6163675075289529459L;

    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    protected PK id;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time")
    protected Date createTime = new Date();

}
